﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Passwords.Models;
using Passwords.Services;

namespace Passwords.Utils
{
    public class CountToPasswordConverter : IValueConverter
    {
        private static readonly string formatString = "{0} passwords and {1} categories";

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            //return ((int)value).ToString() + " " + AppResources.PasswordCountText;
            //Backup backup = value as Backup;
            Backup backup = value as Backup;
            if (!string.IsNullOrEmpty(backup.Info)) return backup.Info;
            return string.Format(formatString, backup.PasswordCount, backup.CategoryCount);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
